package com.zjt.service;

import com.zjt.dao.codecenter.ICenterProductDao;
import com.zjt.entity.codecenter.CenterProduct;
import com.zjt.utils.DateUtil;
import com.zjt.vo.CenterFirmVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * 物码中心数据采集的DAO interface;
 * 
 * @author xueyanbeijing
 */
@Component
public class CodeCenterService implements ICodeCenterService {
    private static Logger logger = LoggerFactory.getLogger(CodeCenterService.class);
    private static String isEnableFlagY = "Y";
    private static String isEnableFlagN = "N";
    private static String isEnableFlagA = "A";
    private ICenterProductDao centerProductDao;
    @Autowired
    public void setCenterProductDao(ICenterProductDao centerProductDao) {
        this.centerProductDao = centerProductDao;
    }

    @Override
    public CenterFirmVO getCenterFirmByName(String firmName) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public CenterProduct saveCenterProduct(String gtin,String itemName,String brandName,String specification,String shortDescription
            ,String description,String height ,String width,String depth ,String netContent,
                                 String grossWeight,String netWeight,String packagingTypeCode,
                                 String packagingMaterialCode,String classCode ,String extension,
                                 String firmName,String address,String firmExtension,int flag) {
        CenterProduct  centerProduct= new CenterProduct();
        centerProduct.setAddress(address);
        centerProduct.setFirmName(firmName);
        centerProduct.setExtension(extension);
        centerProduct.setCreateDate(DateUtil.getCurrentDate());
        centerProduct.setUpdateDate(DateUtil.getCurrentDate());
        centerProduct.setEnableFlag(isEnableFlagY);
        centerProduct.setDepth(depth);
        centerProduct.setBrandName(brandName);
        centerProduct.setClassCode(classCode);
        centerProduct.setDescription(description);
        centerProduct.setFirmExtension(firmExtension);
        centerProduct.setFirmName(firmName);
        centerProduct.setGrossWeight(grossWeight);
        centerProduct.setGtin(gtin);
        centerProduct.setHeight(height);
        centerProduct.setItemName(itemName);
        centerProduct.setNetContent(netContent);
        centerProduct.setPackagingMaterialCode(packagingMaterialCode);
        centerProduct.setShortDescription(shortDescription);
        centerProduct.setPackagingTypeCode(packagingTypeCode);
        centerProduct.setWidth(width);
        centerProduct.setNetWeight(netWeight);

        centerProduct = this.centerProductDao.save(centerProduct);
        return centerProduct;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public CenterProduct getCenterProductByBarCode(String barCode) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CenterProduct> getCenterProductListByFirm(String firmName) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public List<CenterFirmVO> getCenterFirmList() {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public boolean loadCenterDataFromXML(String xmlPath) {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public CenterProduct getCenterProduct(String barCode) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }
}
